package cn.imvc.app.models;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;

import cn.imvc.app.entities.Country;
import cn.imvc.app.repositories.CountryRepository;
import cn.imvc.core.ModelUtil;
import cn.imvc.data.domain.ViewRequest;

@Service
public class CountryModelImpl implements CountryModel{

	@Autowired
	CountryRepository countryRepository;
	public Page<Country> find(ViewRequest viewRequest) {
		return countryRepository.findAll(ModelUtil.OrderByIdDesc(viewRequest));
	}
	@Override
	public Country get(int id) {
		
		return countryRepository.getOne(id);
	}

}
